package com.alibaba.www.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;
@RefreshScope//实现配置自动更新
@RestController
@RequestMapping
public class ConsumerController {
//    @Autowired
//    RestTemplate restTemplate;
//    private final String serverHost="http://nacos-provider";
//
//    @GetMapping(value = "/info")
//    public String getInfo() {
//        return restTemplate.getForObject(serverHost+"/info",String.class);
////        return "hello world!!;";
//    }
    @Autowired
    OpenFeignService openFeignService;

//    @SentinelResource(value = "info",blockHandler = "deal_testHotKey")
    @GetMapping(value = "/info")
    public String getInfo() {
        return openFeignService.getInfo();
    }

}
